package com.zfl.thread.day01;
/*
创建线程1：
继承Thread类，重写run，线程逻辑写入run方法
创建线程+start调用

 */
class Ticket extends Thread{

    private static int ticketNum = 50;

    public Ticket(String name) {
        super(name);
    }

    @Override
    public void run() {
        while(Ticket.ticketNum>0) {
            System.out.println(this.getName() + "卖出一张票，还剩[" + (--ticketNum) + "]张票");
        }

    }
}


public class Demo02 {
    public static void main(String[] args) {
        new Ticket("南京南站").start();
        new Ticket("南京北站").start();
    }
}
